package com.example.demo.web;

import com.example.demo.bean.Author;
import com.example.demo.bean.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gatts, 2020/8/3 21:56
 */
@RestController
public class HelloController {

    @Value(value = "${acg.name}")
    private String acgName;

    @Autowired
    Book book;

    @Autowired
    Author author;

    @RequestMapping("/")
    public String hello(){
        String str1 = "自定义属性 acgName: " + acgName;
        String str2 = "自定义组件 book: " + book;
        System.err.println(str1);
        System.err.println(str2);
        System.err.println("类型安全的属性注入： " + author.toString());
        return "hello world!  " + str1 + "  " + str2 + "  " + author.toString();
    }

}
